local sz_anji = fk.CreateSkill {
    name = "sz_anji",
    dynamic_desc = function(self, player)
        if player:getMark("benghui_juexing") ~= 0 then
            return "sz_anji1"
        end
    end,
}

Fk:loadTranslationTable {
    ["sz_anji"] = "安济",
    [":sz_anji"] = "每回合限一次，当一名角色使用或打出【闪】结算后，你可以进行判定，获得判定结果为红色的牌并标记为“符”，若你没有获得牌，此技能本回合视为未发动过。",
    [":sz_anji1"] = "每回合限一次，当一名角色使用或打出【闪】结算后，你可以进行判定，获得判定结果为黑色的牌并标记为“符”，若你没有获得牌，此技能本回合视为未发动过。",
    ["#anji-invoke"] = "安济：是否发动安济，有概率获得判定牌？",

    ["@@sz_anji-inhand"] = "符",

    ["$sz_anji1"] = "",
    ["$sz_anji2"] = "",
}

local spec = {
    anim_type = "offensive",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(sz_anji.name) and data.card.trueName == "jink" and
            player:usedSkillTimes(sz_anji.name, Player.HistoryTurn) == 0
    end,
    on_cost = function(self, event, target, player, data)
        return player.room:askToSkillInvoke(player, {
            skill_name = sz_anji.name,
            prompt = "#anji-invoke"
        })
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local pattern
        if player:getMark("benghui_juexing") ~= 0 then
            pattern = ".|.|spade,club"
        else
            pattern = ".|.|heart,diamond"
        end
        local judge = {
            who = player,
            reason = sz_anji.name,
            pattern = pattern,
        }
        room:judge(judge)
        if not player.dead and judge:matchPattern() then
            room:moveCardTo(judge.card, Card.PlayerHand, player, fk.ReasonJustMove, sz_anji.name, nil, true, player,
                "@@sz_anji-inhand")
        end
    end,
}

sz_anji:addEffect(fk.CardUseFinished, spec)
sz_anji:addEffect(fk.CardRespondFinished, spec)

return sz_anji
